import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router/router.ts'

// 引入 Element Plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 引入 ECharts (按需引入，这里展示全局引入方式)
import * as echarts from 'echarts'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import {initAuth} from "./access";

// 创建应用实例
const app = createApp(App)
const pinia = createPinia()
app.use(pinia)

// 挂载 Element Plus
app.use(ElementPlus, {
    locale: zhCn, // 设置为中文
});
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 将 ECharts 挂载到全局属性
app.config.globalProperties.$echarts = echarts


// 挂载路由
initAuth(router)
app.use(router)

// 挂载应用
app.mount('#app')
